﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BLL.WWW_WWW.Answers;
using Model;
using Model.WWW_WWW.Answers;
using System.Collections.Generic;
using System.Collections;

namespace BLF.WWW_WWW.Answer
{
    /// <summary>
    /// Answers 的摘要说明
    /// </summary>
    public class Answers
    {
        /// <summary>
        /// 添加问题(T_Answers_Questions、T_Answers_Tag、T_NewsUpdates)(State:true执行成功,Effect:当前问题ID)
        /// </summary>
        /// <param name="akm">问题数据 QuestionModel</param>
        /// <param name="tags">问题标签</param>
        /// <returns>CommonMessage(State:true执行成功,Effect:当前问题ID)</returns>
        public static CommonMessage AddAskQuestion(QuestionModel akm, string tags)
        {
            return (new AnswersSystem()).AddAskQuestion(akm, tags);
        }
        /// <summary>
        /// 添加问题答案（回答问题）(T_Answers_Answers、T_NewsUpdates)
        /// </summary>
        /// <param name="ansm">答案数据 QAnswerModel</param>
        /// <param name="sMailInfo">输出（0:email、1:Nickname、2:Question、3:BaseLanguage）</param>
        /// <returns>CommonMessage</returns>
        public static CommonMessage AddQAnswer(QAnswerModel ansm, out List<string> sMailInfo)
        {
            return (new AnswersSystem()).AddQAnswer(ansm, out sMailInfo);
        }
        /// <summary>
        /// 答案打分
        /// </summary>
        /// <param name="answId">答案ID</param>
        /// <param name="mark">True 加分,false 减分</param>
        /// <param name="memberNo">打分者会员号</param>
        /// <returns>CommonMessage</returns>
        public static CommonMessage AnswerMark(int answId, bool mark, string memberNo)
        {
            return (new AnswersSystem()).AnswerMark(answId, mark, memberNo);
        }
        /// <summary>
        /// 评选最佳答案
        /// </summary>
        /// <param name="status">‘2’最佳答案</param>
        /// <param name="qID">问题ID</param>
        /// <param name="aID">答案ID</param>
        /// <returns>CommonMessage</returns>
        public static CommonMessage AnswerVote(string status, int qID, int aID)
        {
            return (new AnswersSystem()).AnswerVote(status, qID, aID);
        }
        /// <summary>
        /// 获取我的问题列表
        /// </summary>
        /// <param name="memberno">我的编号</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <param name="outList">输出(0:我的问题数量(int)、1:好友的问题3个(QuestionModel列表)、2:好友回答的问题3个QuestionModel列表)</param>
        /// <returns>QuestionModel列表</returns>
        public static List<QuestionModel> GetMyQuestionList(string memberno, int pageIndex, int pageSize, out ArrayList outList)
        {
            return (new AnswersSystem()).GetMyQuestionList(memberno, pageIndex, pageSize, out outList);
        }
        /// <summary>
        /// 获取我回答的问题列表
        /// </summary>
        /// <param name="memberno">我的编号</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <param name="outList">输出(0:我回答的问题数量(int)、1:好友的问题3个(QuestionModel列表)、2:好友回答的问题3个QuestionModel列表)</param>
        /// <returns>QuestionModel列表</returns>
        public static List<QuestionModel> GetMyAnswersQList(string memberno, int pageIndex, int pageSize, out ArrayList outList)
        {
            return (new AnswersSystem()).GetMyAnswersQList(memberno, pageIndex, pageSize, out outList);
        }
        /// <summary>
        /// 获取朋友问题或朋友回答问题 列表
        /// </summary>
        /// <param name="type">0:表示搜索朋友回答的问题，1:表示搜索朋友的问题</param>
        /// <param name="memberno">我的编号</param>
        /// <param name="pageIndex">pageIndex</param>
        /// <param name="pageSize">pageSize</param>
        /// <param name="outList">输出(0：问题数量(朋友问题或朋友回答的问题) int，1：流行标签20个 string List)</param>
        /// <returns>QuestionModel列表</returns>
        public static List<QuestionModel> GetFriendsAQList(int type, string memberno, int pageIndex, int pageSize, out ArrayList outList)
        {
            return (new AnswersSystem()).GetFriendsAQList(type, memberno, pageIndex, pageSize, out outList);
        }
        /// <summary>
        /// 获取问题相关列表
        /// 0:问题详细信息 QuestionModel(QuestionID为下一个问题ID)、1:问题标签列表 string List、2:最佳答案信息QAnswerModel、3:问题答案列表信息QAnswerModel List、
        /// 4:问题答案数目(不包括最佳答案)int、5:相关问题列表(最多10个)QuestionModel List、6:流行问题列表(最多5个)QuestionModel List、
        /// 7:解决问题列表(最多5个)QuestionModel List(当问题Status == "3"、"0"才有数据)
        /// </summary>
        /// <param name="memberno">当前会员号</param>
        /// <param name="qID">问题ID</param>
        /// <param name="pageIndex">答案索引页</param>
        /// <param name="pageSize">答案页数据量</param>
        /// <param name="ll">流行问题涉及学习语言</param>
        /// <param name="sessionID">SessionID</param>
        /// <param name="DateTime">点击时间</param>
        /// <param name="iP">IP地址</param>
        /// <param name="userAgent">浏览器类型</param>
        /// <param name="referer">参考页面</param>
        /// <param name="orderSql">答案排序SQL</param>
        /// <param name="aid">最佳答案id</param>
        /// <returns>ArrayList</returns>
        public static ArrayList GetQuestionDetail(string memberno, int qID, int pageIndex, int pageSize, string ll, string sessionID, string iP, string userAgent, string referer, string orderSql,int aid)
        {
            return (new AnswersSystem()).GetQuestionDetail(memberno, qID, pageIndex, pageSize, ll, sessionID, iP, userAgent, referer, orderSql,aid);
        }

        /// <summary>
        /// 得到Question的信息（主页面）
        /// </summary>
        /// <param name="memberNo">会员号</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="sql1">查询条件</param>
        /// <param name="sql2">语言条件</param>
        /// <param name="sortField">排序提案件</param>
        /// <param name="questionsCount">总问题数</param>
        /// <param name="antList">List（AnswersTagModel）</param>
        /// <returns>List（QuestionModel）</returns>
        public static List<QuestionModel> GetQuestion(int pageIndex, int pageSize, string ll, string bl, string sortField,int dtype, out int questionsCount, out List<AnswersTagModel> antList)
        {
            return (new AnswersSystem()).GetQuestion(pageIndex, pageSize, ll, bl, sortField,dtype, out questionsCount, out antList);
        }
        /// <summary>
        /// 获取用户问题与答案情况(用户号、昵称、国籍、母语、学习语言、问题数、回答数、最佳答案数)
        /// </summary>
        /// <param name="orderType">排序（1:回答数，2:问题数，3:最佳答案数）</param>
        /// <param name="sql1">目标语言条件</param>
        /// <param name="sql2">目标和其于语言条件</param>
        /// <param name="queList1">输出最流行的问题</param>
        /// <param name="queList2">输出最新的问题</param>
        /// <returns>UserAQStatsModel列表</returns>
        public static List<UserAQStatsModel> GetUserStats(int orderType, string ll, string bl, out List<QuestionModel> queList1, out List<QuestionModel> queList2)
        {
            return (new AnswersSystem()).GetUserStats(orderType, ll, bl, out queList1, out queList2);
        }
        /// <summary>
        /// 得到最流行的问题和最新的问题
        /// </summary>
        /// <param name="sql1">语言条件</param>
        /// <param name="queList">输出最新问题</param>
        /// <returns>流行问题</returns>
        public static List<QuestionModel> GetPuLa(string ll, out List<QuestionModel> queList)
        {
            return (new AnswersSystem()).GetPuLa(ll, out queList);
        }
        /// <summary>
        /// 得到一周内hostTAG和HOST TAG和最流行的问题和最新的问题
        /// </summary>
        /// <param name="sql1">目标语言条件</param>
        /// <param name="sql2">目标和其于语言条件</param>
        /// <param name="tagList">所有时间里的最流行的TAG</param>
        /// <param name="queList1">输出最流行的问题</param>
        /// <param name="queList2">输出最新问题</param>
        /// <returns>上周流行的TAG</returns>
        public static List<AnswersTagModel> GetTagPuLa(string memberNo, string ll, string bl, out List<AnswersTagModel> antList, out List<QuestionModel> queList1, out List<QuestionModel> queList2)
        {
            return (new AnswersSystem()).GetTagPuLa(memberNo, ll, bl, out  antList, out queList1, out  queList2);
        }
        /// <summary>
        /// 得到TAG相关的问题
        /// </summary>
        /// <param name="tag">tag</param>
        /// <param name="pageIndex">页面</param>
        /// <param name="pageSize">大小</param>
        /// <param name="sql1">语言条件</param>
        /// <param name="sortField">排序条件</param>
        /// <param name="questionsCount">输出数量</param>
        /// <param name="antList">输出List（AnswersTagModel）</param>
        /// <returns>List(QuestionModel)</returns>
        public static List<QuestionModel> GetTagQuestion(string tag, int pageIndex, int pageSize, string ll,string bl, string sortField, out int questionsCount, out List<AnswersTagModel> antList)
        {
            return (new AnswersSystem()).GetTagQuestion(tag, pageIndex, pageSize, ll,bl, sortField, out questionsCount, out antList);
        }
        /// <summary>
        /// 得到Question的信息（主页面）
        /// </summary>
        /// <param name="memberNo">会员号</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="questionsCount">总问题数</param>
        /// <param name="antList">List（AnswersTagModel）</param>
        /// <param name="baseLanguage">输出使用语言</param>
        /// <param name="languageLearn">输出目标语言</param>
        /// <returns>List（QuestionModel）</returns>
        public static List<QuestionModel> GetQuestion(string memberNo, int pageIndex, int pageSize, out int questionsCount, out List<AnswersTagModel> antList, out string languageLearn, out string baseLanguage)
        {
            return (new AnswersSystem()).GetQuestion(memberNo, pageIndex, pageSize, out questionsCount, out antList, out languageLearn, out baseLanguage);
        }
        /// <summary>
        /// 得到搜索的问题
        /// </summary>
        /// <param name="pageIndex">页面</param>
        /// <param name="pageSize">大小</param>
        /// <param name="sql1">搜索条件</param>
        /// <param name="sql2">语言条件</param>
        /// <param name="sortField">排序</param>
        /// <param name="questionsCount">输出搜索的问题数量</param>
        /// <param name="antList">输出20个AnswersTagModel（标签）</param>
        /// <returns>List（QuestionModel）</returns>
        public static List<QuestionModel> GetQuestionSearch(int pageIndex, int pageSize, string ll, string bl, string sortField,string key,string st ,out int questionsCount, out List<AnswersTagModel> antList)
        {
            return (new AnswersSystem()).GetQuestionSearch(pageIndex, pageSize, ll, bl, sortField,key, st,out questionsCount, out antList);
        }
        /// <summary>
        /// 得到我的5个问题
        /// </summary>
        /// <param name="memberno">我的会员号</param>
        /// <param name="recordCount">我的问题数量</param>
        /// <returns>List（QuestionModel）</returns>
        public static List<QuestionModel> GetMyQuestion(string memberno, out int recordCount)
        {
            return (new AnswersSystem()).GetMyQuestion(memberno, out recordCount);
        }
    }
}
